using Steamworks;
using UnityEngine;

public class SteamAchievements : MonoBehaviour
{
	public static void UnlockAchievement(string achievementId)
	{
		if (SteamOpen() && !AchievementUnlocked(achievementId))
		{
			SteamUserStats.SetAchievement(achievementId);
			SteamUserStats.StoreStats();
		}
	}

	private static bool AchievementUnlocked(string achievementId)
	{
		SteamUserStats.GetAchievement(achievementId, out var pbAchieved);
		return pbAchieved;
	}

	private static bool SteamOpen()
	{
		return SteamManager.Initialized;
	}

	private static void ClearAllAchievement()
	{
		SteamUserStats.ResetAllStats(bAchievementsToo: true);
	}
}
